// import { createRouter, createWebHistory } from 'vue-router'

// export const routerFiles = import.meta.glob(
//   ['../views/**/index.vue', '!**/components/**'],
//   { eager: true }
// )
// const routeList = []
// const upperName = name =>
//   name
//     .split('/')
//     .map(da => da.replace(/^\w/g, d => d.toUpperCase()))
//     .join('')

// for (const [key, component] of Object.entries(routerFiles)) {
//   const path = key.replace('../views', '').replace('/index.vue', '')
//   const isEdit = path.indexOf('/edit') > -1

//   const name = upperName(path.replace('/', ''))
//   component.default.name = name
//   routeList.push({
//     path: isEdit ? path.replace('/edit', '/edit/:id') : path,
//     name,
//     component: async () => component,
//     props: isEdit,
//     hidden: isEdit,
//     meta: {},
//   })
// }

// export const routes = routeList

// console.log('purchase routes', routes)
// const router = createRouter({
//   history: createWebHistory(import.meta.env.BASE_URL),
//   routes,
// })
// export default router
import { createRouter, createWebHistory } from 'vue-router'
import DKVui from 'dk-vui'

const routerFiles = import.meta.globEager(['../views/**/index.vue', '!**/components/**'])
console.log(routerFiles);
export const routes = DKVui.getRoutes(routerFiles, 'Oms')
// routes.forEach(v=>{
//   if(v.path == '/user/list/detail'){
//     v.path  = '/user/list/detail/:id'
//   }
// })
console.log('Oms routes', routes)
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})
export default router